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 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
|
*/
|
@Service
|
public class ComPushService11 {
|
|
@Autowired
|
private Api1101Rep api1101Rep;
|
@Autowired
|
private Api1102Rep api1102Rep;
|
@Autowired
|
private Api1107Rep api1107Rep;
|
@Autowired
|
private Api1111Rep api1111Rep;
|
@Autowired
|
private Api1112Rep api1112Rep;
|
/**
|
* 1101 单位信息
|
*/
|
public void pushData1101(ApiRemoteService apiRemoteService, ApiParam param) {
|
|
List<Api1101> items = api1101Rep.findPushData(param.getKqdm());
|
if (null == items || items.isEmpty()) {
|
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.findPushData(param.getKqdm());
|
if (null == items || items.isEmpty()) {
|
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.getDwdm(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 1107 设备信息
|
*/
|
public void pushData1107(ApiRemoteService apiRemoteService, ApiParam param) {
|
|
List<Api1107> items = api1107Rep.findPushData(param.getKqdm());
|
if (null == items || items.isEmpty()) {
|
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.getDwdm(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 1111 库区图视频监控设备点位标注
|
*/
|
public void pushData1111(ApiRemoteService apiRemoteService, ApiParam param) {
|
|
List<Api1111> items = api1111Rep.findPushData(param.getKqdm());
|
if (null == items || items.isEmpty()) {
|
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.findPushData(param.getKqdm());
|
if (null == items || items.isEmpty()) {
|
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);
|
}
|
}
|
}
|
}
|
}
|