| | |
| | | import com.fzzy.otherview.whhpjl.dto.WhjlApi1101; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | */ |
| | | @Expose |
| | | public String pushData(List<WhjlApi1101> items) { |
| | | ResponseDto responseDto; |
| | | |
| | | String result = ""; |
| | | |
| | | String kqdm = items.get(0).getKqdm(); |
| | | ApiConfs apiConf = apiCommonService.getConf(kqdm); |
| | | |
| | | if (null == apiConf) return "系统没有获取到当前库区配置信息,执行失败"; |
| | | if (null == apiConf) { |
| | | return "系统没有获取到当前库区配置信息,执行失败"; |
| | | } |
| | | |
| | | //封装参数 |
| | | ApiParam param = new ApiParam(apiConf, WhjlConstant.API_CATEGORY_11, WhjlConstant.API_CODE_1101); |
| | | |
| | | //获取实现接口 |
| | | ApiRemoteService apiService = apiPushManager.getApiRemoteService(param.getPushProtocol()); |
| | | if (null == apiService) return "系统没有当前推送协议配置,执行失败"; |
| | | if (null == apiService) { |
| | | return "系统没有当前推送协议配置,执行失败"; |
| | | } |
| | | |
| | | //推送,数据为集合形式 |
| | | responseDto = apiService.pushData(param, apiConf, items); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | |
| | | ResponseDto responseDto; |
| | | ApiInfoData infoData; |
| | | for (WhjlApi1101 data : items) { |
| | | responseDto = apiService.pushData(param, apiConf, items); |
| | | if (responseDto.getSuccess() == 0) { |
| | | if(Constant.CZBZ_I.equals(data.getCzbz())){ |
| | | |
| | | infoData = new ApiInfoData(); |
| | | infoData.setId(data.getBizId()); |
| | | infoData.setKqdm(data.getKqdm()); |
| | |
| | | data.setCzbz(Constant.CZBZ_U); |
| | | infoData.setCzbz(Constant.CZBZ_U); |
| | | infoData.setData(JSON.toJSONString(data)); |
| | | |
| | | apiInfoDataRep.save(infoData); |
| | | } |
| | | } |