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 ComPushService12 {
|
|
@Autowired
|
private Api1109Rep api1109Rep;
|
@Autowired
|
private Api1201Rep api1201Rep;
|
@Autowired
|
private Api1202Rep api1202Rep;
|
@Autowired
|
private Api1203Rep api1203Rep;
|
@Autowired
|
private Api1204Rep api1204Rep;
|
@Autowired
|
private Api1205Rep api1205Rep;
|
@Autowired
|
private Api1206Rep api1206Rep;
|
@Autowired
|
private Api1207Rep api1207Rep;
|
@Autowired
|
private Api1208Rep api1208Rep;
|
@Autowired
|
private Api1209Rep api1209Rep;
|
@Autowired
|
private Api1210Rep api1210Rep;
|
|
/**
|
* 1109 文件信息同步
|
*/
|
public void pushData1109(ApiRemoteService apiRemoteService, ApiParam param) {
|
|
List<Api1109> items = api1109Rep.findPushData(param.getKqdm());
|
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
|
param.setInteCategory(Constant.API_CATEGORY_11);
|
param.setInteId(Constant.API_CODE_1109);
|
|
ResponseDto responseDto;
|
|
for (Api1109 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1201Rep.updateStatus(data.getId(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 合同同步
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1201(ApiRemoteService apiRemoteService, ApiParam param) {
|
List<Api1201> items = api1201Rep.findPushData(param.getKqdm());
|
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1201);
|
|
ResponseDto responseDto;
|
|
for (Api1201 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1201Rep.updateStatus(data.getHth(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 粮食入库数据
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1202(ApiRemoteService apiRemoteService, ApiParam param) {
|
List<Api1202> items = api1202Rep.findPushData(param.getKqdm());
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1202);
|
|
ResponseDto responseDto;
|
for (Api1202 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1202Rep.updateStatus(data.getId(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 入库质检
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1203(ApiRemoteService apiRemoteService, ApiParam param) {
|
List<Api1203> items = api1203Rep.findPushData(param.getKqdm());
|
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1203);
|
|
ResponseDto responseDto;
|
for (Api1203 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1203Rep.updateStatus(data.getBizId(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 入库结算
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1204(ApiRemoteService apiRemoteService, ApiParam param) {
|
List<Api1204> items = api1204Rep.findPushData(param.getKqdm());
|
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1204);
|
|
ResponseDto responseDto;
|
for (Api1204 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1204Rep.updateStatus(data.getRkjsdh(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 粮食出库
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1205(ApiRemoteService apiRemoteService, ApiParam param) {
|
List<Api1205> items = api1205Rep.findPushData(param.getKqdm());
|
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1205);
|
|
|
ResponseDto responseDto;
|
for (Api1205 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1205Rep.updateStatus(data.getId(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 出库结算
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1206(ApiRemoteService apiRemoteService, ApiParam param) {
|
List<Api1206> items = api1206Rep.findPushData(param.getKqdm());
|
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1206);
|
|
ResponseDto responseDto;
|
for (Api1206 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1206Rep.updateStatus(data.getCkjsdh(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 倒仓数据
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1207(ApiRemoteService apiRemoteService, ApiParam param) {
|
List<Api1207> items = api1207Rep.findPushData(param.getKqdm());
|
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1207);
|
|
|
ResponseDto responseDto;
|
for (Api1207 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1207Rep.updateStatus(data.getDcdh(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 粮食库存数据接口
|
*
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1208(ApiRemoteService apiRemoteService, ApiParam param) {
|
|
//获取数据
|
List<Api1208> items = api1208Rep.findPushData(param.getKqdm());
|
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1208);
|
|
ResponseDto responseDto;
|
|
for (Api1208 data : items) {
|
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1208Rep.updateStatus(data.getId(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 损益单
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1209(ApiRemoteService apiRemoteService, ApiParam param) {
|
List<Api1209> items = api1209Rep.findPushData(param.getKqdm());
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1209);
|
|
ResponseDto responseDto;
|
for (Api1209 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1209Rep.updateStatus(data.getSydh(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
|
/**
|
* 粮食性质转变
|
* @param apiRemoteService
|
* @param param
|
*/
|
public void pushData1210(ApiRemoteService apiRemoteService, ApiParam param) {
|
List<Api1210> items = api1210Rep.findPushData(param.getKqdm());
|
|
if (null == items || items.isEmpty()) {
|
return;
|
}
|
|
param.setInteCategory(Constant.API_CATEGORY_12);
|
param.setInteId(Constant.API_CODE_1210);
|
|
ResponseDto responseDto;
|
for (Api1210 data : items) {
|
param.setBizId(data.getBizId());
|
responseDto = apiRemoteService.pushData(param, data);
|
|
if (responseDto.getSuccess() == 0) {
|
if (Constant.CZBZ_I.equals(data.getCzbz())) {
|
api1210Rep.updateStatus(data.getLsxzzbdh(), Constant.CZBZ_U);
|
}
|
}
|
}
|
}
|
}
|