czt
2024-11-25 5c39705408824d92ec5fcc261b9cb618dc3cf65d
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
package com.fzzy.push.impl;
 
import com.fzzy.api.Constant;
import com.fzzy.api.data.ApiParam;
import com.fzzy.api.dto.ResponseDto;
import com.fzzy.api.entity.*;
import com.fzzy.api.service.ApiRemoteService;
import com.fzzy.api.view.repository.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * @Desc: 通用实现类,针对粮库管理国标接口数据的 推送实现,系统会根据不同接定义的实现逻辑自动调用
 * @author: andy.jia
 * @update-time: 2022/10/28 2:02
 */
@Slf4j
@Service
public class ComPushService11 {
 
    @Autowired
    private Api1101Rep api1101Rep;
    @Autowired
    private Api1102Rep api1102Rep;
    @Autowired
    private Api1103Rep api1103Rep;
    @Autowired
    private Api1104Rep api1104Rep;
    @Autowired
    private Api1105Rep api1105Rep;
    @Autowired
    private Api1106Rep api1106Rep;
    @Autowired
    private Api1107Rep api1107Rep;
    @Autowired
    private Api1108Rep api1108Rep;
    @Autowired
    private Api1110Rep api1110Rep;
    @Autowired
    private Api1111Rep api1111Rep;
    @Autowired
    private Api1112Rep api1112Rep;
    @Autowired
    private Api1113Rep api1113Rep;
 
    /**
     * 1101 单位信息
     */
    public void pushData1101(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1101> items = api1101Rep.getDataByTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到单位信息,不推送-----");
            return;
        }
 
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1101);
 
        ResponseDto responseDto;
        for (Api1101 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1101Rep.updateStatus(data.getDwdm(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1102 库区信息
     */
    public void pushData1102(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1102> items = api1102Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到库区信息,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1102);
 
        ResponseDto responseDto;
        for (Api1102 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1102Rep.updateStatus(data.getKqdm(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1103 仓房信息
     */
    public void pushData1103(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1103> items = api1103Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到仓房信息,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1103);
 
        ResponseDto responseDto;
        for (Api1103 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1103Rep.updateStatus(data.getCfdm(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1104 廒间信息
     */
    public void pushData1104(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1104> items = api1104Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到廒间信息,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1104);
 
        ResponseDto responseDto;
        for (Api1104 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1104Rep.updateStatus(data.getAjdh(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1105 货位信息
     */
    public void pushData1105(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1105> items = api1105Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到货位信息,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1105);
 
        ResponseDto responseDto;
        for (Api1105 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1105Rep.updateStatus(data.getHwdm(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1106 油罐信息
     */
    public void pushData1106(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1106> items = api1106Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到油罐信息,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1106);
 
        ResponseDto responseDto;
        for (Api1106 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1106Rep.updateStatus(data.getYgdm(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1107 设备信息
     */
    public void pushData1107(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1107> items = api1107Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到设备信息,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1107);
 
        ResponseDto responseDto;
        for (Api1107 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1107Rep.updateStatus(data.getSbbh(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1108 药剂信息
     */
    public void pushData1108(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1108> items = api1108Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到药剂信息,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1108);
 
        ResponseDto responseDto;
        for (Api1108 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1108Rep.updateStatus(data.getId(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1110 库区图仓房点位信息
     */
    public void pushData1110(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1110> items = api1110Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到库区图仓房点位标注,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1110);
 
        ResponseDto responseDto;
        for (Api1110 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1110Rep.updateStatus(data.getHwdm(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1111 库区图视频监控设备点位标注
     */
    public void pushData1111(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1111> items = api1111Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到库区图视频监控设备点位标注,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1111);
 
        ResponseDto responseDto;
        for (Api1111 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1111Rep.updateStatus(data.getSpjksbid(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1112 人员信息
     *
     */
    public void pushData1112(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1112> items = api1112Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到人员信息,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1112);
 
        ResponseDto responseDto;
        for (Api1112 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    api1112Rep.updateStatus(data.getSfzhm(), Constant.CZBZ_U);
                }
            }
        }
    }
 
    /**
     * 1113 企业信用信息
     *
     */
    public void pushData1113(ApiRemoteService apiRemoteService, ApiParam param) {
 
        List<Api1113> items = api1113Rep.findPushDataTime(param.getKqdm(), param.getStart(), param.getEnd());
        if (null == items || items.isEmpty()) {
            log.error("-----未获取到企业信用信息,不推送-----");
            return;
        }
 
        param.setInteCategory(Constant.API_CATEGORY_11);
        param.setInteId(Constant.API_CODE_1113);
 
        ResponseDto responseDto;
        for (Api1113 data : items) {
            param.setBizId(data.getBizId());
            responseDto = apiRemoteService.pushData(param, data);
 
            if (responseDto.getSuccess() == 0) {
                if (Constant.CZBZ_I.equals(data.getCzbz())) {
                    data.setCzbz("u");
                    api1113Rep.save(data);
                }
            }
        }
    }
 
}